var $dlgGoto = (function() {
  var html = ''
    + '<div class="notepad-dlg-goto">'
      + '<div class="dialogbox">'
        + '<div class="titlebar">'
          + '<p class="title">查找</p>'
          + '<span class="close-btn">×</span>'
        + '</div>'
      + '<div class="main">'
        + '<label>查找内容(<u>N</u>):</label>'
        + '<input class="txt-line-num" type="text" autofocus>'
        + '<br>'
        + '<input class="btn-goto" type="button" value="查找下一个(F)">'
        + '<input class="btn-cancel" type="button" value="取消">'
        + '<fieldset class="direction">'
          + '<legend>方向</legend>'
          + '<input class="up" type="radio" name="dic" value="up">向上(<u>U</u>)'
          + '<input class="down" type="radio" name="dic" value="down" checked>向下(<u>U</u>)'
        + '</fieldset>'
        + '<input class="bs" type="checkbox" name="more" value="bs">区分大小写(<u>C</u>)<br>'
        + '<input class="loop" type="checkbox" name="more" value="loop">循环(<u>R</u>)'

      + '</div>'
    + '</div>'
  + '</div>',

  
  $dlg = $(html),
  $btn = $dlg.find('.btn-goto'),
  $btnClose = $dlg.find('.close-btn'),
  $btnCancel = $dlg.find('.btn-cancel'),                         
                                         
  cfg  = {
    container: 'body',
    num:       6,
    title:     '同意',
    onClick:   null
  };

  function cancel() {
    var txt = document.getElementsByClassName('txt-line-num')[0];
    txt.value = '';
    $dlg.remove();
  };

  function print() {
    var txt = document.getElementsByClassName('txt-line-num')[0];
    if(txt.value){
      console.log(txt.value);
    }
    //console.log(txt.value);
  }


  function show(conf) {
    $(cfg.container).append($dlg);
    $.extend(cfg,conf);
    
    $btn.click(print);
    $btnClose.click(cancel);
    $btnCancel.click(cancel);
  };


  return {
    show:show
  }
  
}())
